import "@tarojs/async-await";
import Taro, { Component } from "@tarojs/taro";
import { Provider } from "@tarojs/redux";

import Index from "./pages/index";

import configStore from "./store";
import "taro-ui/dist/style/index.scss";
import "./app.less";


// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

const store = configStore();

class App extends Component {
  config = {
    pages: [
      "pages/index/index",
      "pages/customer/index",
      "pages/mine/index",
      "pages/customer/list",
      "pages/customer/success",
      "pages/mine/info",
      "pages/mine/account",
      "pages/mine/contact",
      "pages/mine/withdrawal",
      "pages/mine/complete",
      "pages/mine/success",
      "pages/mine/detail",
      "pages/index/search",
      "pages/index/task",
      "pages/mine/register",
      "pages/index/sharecontent",
      "pages/mine/agreement"
    ],
    window: {
      navigationBarTitleText: "客盈门",
      backgroundTextStyle: "light",
      navigationBarBackgroundColor: "#fff",
      navigationBarTitleText: "WeChat",
      navigationBarTextStyle: "black"
    },
    tabBar: {
      color: "#939393",
      selectedColor: "#5FB4FA",
      list: [
        {
          pagePath: "pages/index/index",
          iconPath: "assets/img/home1.png",
          selectedIconPath: "assets/img/home2.png",
          text: "任务"
        },
        {
          pagePath: "pages/customer/index",
          iconPath: "assets/img/customer1.png",
          selectedIconPath: "assets/img/customer2.png",
          text: "客户"
        },
        {
          pagePath: "pages/mine/index",
          iconPath: "assets/img/mine1.png",
          selectedIconPath: "assets/img/mine2.png",
          text: "我的"
        }
      ]
    }
  };

  async componentDidMount() {
    if (!sessionStorage.getItem("realIosShareUrl")) {
      let url = window.location.href
      await sessionStorage.setItem('realIosShareUrl',url)
    }
  }

  componentDidShow() {}

  componentDidHide() {}

  componentCatchError() {}

  componentDidCatchError() {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render() {
    return (
      <Provider store={store}>
        <Index />
      </Provider>
    );
  }
}

Taro.render(<App />, document.getElementById("app"));
